#include<iostream>
#include"IOCP.h"
#include<string>

using namespace std;

extern CIOCP* g_server;

DWORD WINAPI ServerThread(LPVOID lpParam)
{
	g_server->ListenAccept();
	return 0;
}

int main()
{

	HANDLE hServer = CreateThread(NULL, 0, ServerThread, NULL, 0, NULL);

	std::string str;

	while (str != "exit")
	{
		cin >> str;
		if (str == "client")
		{
			g_server->PrintClient();
		}
		else if (str == "exit")
		{
			g_server->ShutdownServ();
			TerminateThread(hServer, 0);
			break;
		}
	}



	return 0;
}